<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>👍python内置属性(魔法方法) | manor blog</title>
  
    <meta name="keywords" content=" attr ">
  
  <meta name="description" content="👍python内置属性(魔法方法) | manor blog">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="个人简介pgmanor，程序员一名。 喜欢研究技术，涉及GO、JAVA、微服务、大数据领域。目前主要从事微服务。 联系方式 QQ : 2307546059 (pgmanor) 邮箱 :pgmanor@qq.com">
<meta property="og:type" content="website">
<meta property="og:title" content="关于">
<meta property="og:url" content="https://pgmanor.gitee.io/blog/about/index.html">
<meta property="og:site_name" content="manor blog">
<meta property="og:description" content="个人简介pgmanor，程序员一名。 喜欢研究技术，涉及GO、JAVA、微服务、大数据领域。目前主要从事微服务。 联系方式 QQ : 2307546059 (pgmanor) 邮箱 :pgmanor@qq.com">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2020-12-30T16:00:00.000Z">
<meta property="article:modified_time" content="2020-12-15T14:30:19.631Z">
<meta property="article:author" content="pgmanor">
<meta property="article:tag" content="pgmanor">
<meta property="article:tag" content="blog">
<meta name="twitter:card" content="summary">


<link rel="icon" href="/blog/img/pgmanor_blog.svg">

<link href="/blog/css/style.css?v=1.0.1x" rel="stylesheet">

<link href="/blog/css/hl_theme/atom-light.css?v=1.0.1x" rel="stylesheet">

<link href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/js/fontawesome.min.js" rel="stylesheet">

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="/blog/js/jquery.autocomplete.min.js?v=1.0.1x" ></script>
<script src="/blog/js/titleTip.js?v=1.0.1x" ></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.0.3/highlight.min.js"></script>
<script>
    hljs.initHighlightingOnLoad();
</script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/nprogress/0.2.0/nprogress.min.js"></script>



<script src="/blog/js/iconfont.js?v=1.0.1x" ></script>

<meta name="generator" content="Hexo 4.2.1"></head>
<div style="display: none">
  <input class="theme_disqus_on" value="false">
  <input class="theme_preload_comment" value="false">
  <input class="theme_blog_path" value="/blog">
  <input id="theme_highlight_on" value="true" />
  <input id="theme_code_copy" value="true" />
</div>




<body>
<aside class="nav">
    <div class="nav-left">
        <a href="/blog/" class="avatar_target">
    <img class="avatar" src="/blog/img/pgmanor_blog.svg" />
</a>
<div class="author">
    <span>pgmanor</span>
</div>

<div class="icon">
    
        
        <a title="github" href="https://gitee.com/pgmanor" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-github"></use>
                </svg>
            
        </a>
        
    
        
        <a title="csdn" href="https://blog.csdn.net/u011622109" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-csdn"></use>
                </svg>
            
        </a>
        
    
        
        <a title="email" href="mailto:pgmanor@qq.com" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-email"></use>
                </svg>
            
        </a>
        
    
        
        <a title="qq" href="http://wpa.qq.com/msgrd?v=3&uin=2307546059&site=qq&menu=yes" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-qq"></use>
                </svg>
            
        </a>
        
    
        
        <a title="kugou" href="https://www.kugou.com/" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-kugou"></use>
                </svg>
            
        </a>
        
    
        
        <a title="neteasemusic" href="https://music.163.com/" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true">
                    <use xlink:href="#icon-neteasemusic"></use>
                </svg>
            
        </a>
        
    
</div>



<a class="more-menus">更多菜单</a>


<ul>
    <li><div class="all active">全部文章<small>(129)</small></div></li>
    
        
            
            <li><div data-rel="博客"><i class="fold iconfont icon-right"></i>博客<small>(108)</small></div>
                
                    <ul class="sub hide">
                        
                        <li><div data-rel="B---大数据">B---大数据<small>(4)</small></div>
                            
                        </li>
                            
                        <li><div data-rel="C-----并发">C-----并发<small>(1)</small></div>
                            
                        </li>
                            
                        <li><div data-rel="D--数据库">D--数据库<small>(16)</small></div>
                            
                        </li>
                            
                        <li><div data-rel="D-devops">D-devops<small>(5)</small></div>
                            
                        </li>
                            
                        <li><div data-rel="F-----架构">F-----架构<small>(10)</small></div>
                            
                        </li>
                            
                        <li><div data-rel="I-----面试">I-----面试<small>(2)</small></div>
                            
                        </li>
                            
                        <li><div data-rel="J-----java">J-----java<small>(14)</small></div>
                            
                        </li>
                            
                        <li><div data-rel="M--微服务">M--微服务<small>(6)</small></div>
                            
                        </li>
                            
                        <li><div data-rel="P-python">P-python<small>(9)</small></div>
                            
                        </li>
                            
                        <li><div data-rel="T-----工具">T-----工具<small>(26)</small></div>
                            
                        </li>
                            
                        <li><div data-rel="T-----测试">T-----测试<small>(6)</small></div>
                            
                        </li>
                            
                        <li><div data-rel="W-----前端">W-----前端<small>(4)</small></div>
                            
                        </li>
                            
                        <li><div data-rel="W-window">W-window<small>(3)</small></div>
                            
                        </li>
                            
                        <li><div data-rel="微服务">微服务<small>(2)</small></div>
                            
                        </li>
                            
                    </ul>
                
            </li>
            
        
    
        
            
            <li><div data-rel="农场"><i class="fold iconfont icon-right"></i>农场<small>(10)</small></div>
                
                    <ul class="sub hide">
                        
                        <li><div data-rel="微服务">微服务<small>(1)</small></div>
                            
                        </li>
                            
                        <li><div data-rel="算法">算法<small>(8)</small></div>
                            
                        </li>
                            
                    </ul>
                
            </li>
            
        
    
        
            
            <li><div data-rel="项目">项目<small>(9)</small></div>
                
            </li>
            
        
    
        
            
            <li><div data-rel="加密">加密<small>(2)</small></div>
                
            </li>
            
        
    
        
            
        
    
        
            
        
    
        
            
        
    
        
            
        
    
        
            
        
    
        
            
        
    
        
            
        
    
        
            
        
    
        
            
        
    
        
            
        
    
        
            
        
    
        
            
        
    
        
            
        
    
        
            
        
    
        
            
        
    
        
            
        
    
</ul>
<div class="left-bottom">
    <div class="menus">
    
    
    
    <a class="dynamic-menu " target="_blank"  href="https://www.iworkh.com/">iworkh</a>
    
    
    <a class="dynamic-menu " target="_blank"  href="https://gitee.com/pgmanor">gitee</a>
    
    </div>
    <div><a class="about  hasFriend  site_url"  href="/blog/about">关于</a><a style="width: 50%"  class="friends">友链</a></div>
</div>
<input type="hidden" id="iworkh_site_posts_number" value="129">
<input type="hidden" id="iworkh_site_word_count" value="273k">
<div style="display: none">
    <span id="busuanzi_value_site_uv"></span>
    <span id="busuanzi_value_site_pv"></span>
</div>

    </div>
    <div class="nav-right">
        <div class="friends-area">
    <div class="friends-title">
        友情链接
        <i class="back-title-list"></i>
    </div>
    <div class="friends-content">
        <ul>
            
            <li><a target="_blank" href="https://www.iworkh.com">iworkh</a></li>
            
            <li><a target="_blank" href="https://www.iworkh.com/download/share/">下载地址</a></li>
            
            <li><a target="_blank" href="http://yelog.org/">叶落阁</a></li>
            
        </ul>
    </div>
</div>
        <div class="title-list">
    <form onkeydown="if(event.keyCode === 13){return false;}">
        <input id="local-search-input" class="search" type="text" placeholder="in: 开头全文搜索" />
        <i class="cross"></i>
        <span>
            <label for="tagswitch">T:</label>
            <input id="tagswitch" type="checkbox" style="display: none" />
            <i id="tagsWitchIcon"></i>
        </span>
    </form>
    <div class="tags-list">
    
    <li class="article-tag-list-item">
        <a class="color4">AQS</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">attr</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color1">aysnc</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">beanmap</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color1">bigdecimal</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">blog</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color2">chrome</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">dict</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">dll</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">doc</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color2">docker</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color2">domain</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">elementadmin</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">es</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color1">excel</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">farm</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">fastjson</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">func</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">git</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color2">github</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color1">guide</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color2">hadoop</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">hexo</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">idea</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">initialzr</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">jackson</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">java</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color1">jboss</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">jdni</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">jetbrains</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color2">jfinalshell</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color2">joplin</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">JPA</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color1">junit</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">jupyter</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">keepavlie</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">kill</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color1">linux</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">LocalDate</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">lock</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">markdown</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color1">maven</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">message</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">mock</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">mq</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color1">mycat</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color1">mysql</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color1">nginx</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">notebook</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">postman</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">powermock</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color2">python</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color1">redis</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">rest</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">sharding-jdbc</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color1">spark</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color1">springboot</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color2">testng</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">tornado</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color1">track</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">transactional</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">uuid</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">vuepress</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">web</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">windows</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">zookeeper</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">分库分表</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">分页</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">加密</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">启动</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">工具</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">并发</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">序列化</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">微服务</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">性能分析</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">手册</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">有道云</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">模板</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">百度云盘</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">算法</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">面试</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">项目</a>
    </li>
    
    <div class="clearfix"></div>
</div>

    
    <div id="local-search-result">

    </div>
    
    <nav id="title-list-nav">
        
        <a id="top" class="农场 "
           href="/blog/2020/12/31/farm-manual-summary/"
           data-tag="手册,farm"
           data-author="pgmanor" >
            <span class="post-title" title="手册汇总">手册汇总</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a id="top" class="农场 微服务 "
           href="/blog/2020/12/31/farm-spring-boot-all-resources/"
           data-tag="springboot"
           data-author="pgmanor" >
            <span class="post-title" title="Spring Boot全网优质教程汇总">Spring Boot全网优质教程汇总</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a id="top" class="加密 "
           href="/blog/2021/01/10/secret-farm-mysql/"
           data-tag="mysql"
           data-author="pgmanor" >
            <span class="post-title" title="mysql密钥">mysql密钥</span>
            <span class="post-date" title="2021-01-10 00:00:00">2021/01/10</span>
        </a>
        
        <a id="top" class="加密 "
           href="/blog/2020/12/31/secret-baidu-pandisk-share/"
           data-tag="百度云盘"
           data-author="pgmanor" >
            <span class="post-title" title="百度云盘分享链接">百度云盘分享链接</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a id="top" class="博客 T-----工具 "
           href="/blog/2020/12/31/blog-jetbrains-idea/"
           data-tag="idea"
           data-author="pgmanor" >
            <span class="post-title" title="idea使用技巧">idea使用技巧</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a id="top" class="博客 T-----工具 "
           href="/blog/2021/03/14/blog-tool-online/"
           data-tag="blog"
           data-author="pgmanor" >
            <span class="post-title" title="常用在线工具">常用在线工具</span>
            <span class="post-date" title="2021-03-14 00:00:00">2021/03/14</span>
        </a>
        
        <a id="top" class="博客 W-----前端 "
           href="/blog/2020/12/31/blog-web/"
           data-tag="web"
           data-author="pgmanor" >
            <span class="post-title" title="前端常用工具">前端常用工具</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="项目 "
           href="/blog/2021/09/12/project-guide-http/"
           data-tag="项目,guide"
           data-author="pgmanor" >
            <span class="post-title" title="模拟http请求">模拟http请求</span>
            <span class="post-date" title="2021-09-12 00:00:00">2021/09/12</span>
        </a>
        
        <a  class="博客 T-----工具 "
           href="/blog/2021/09/12/blog-tool-chrome-disable-cros/"
           data-tag="chrome"
           data-author="pgmanor" >
            <span class="post-title" title="禁用Chrome跨域">禁用Chrome跨域</span>
            <span class="post-date" title="2021-09-12 00:00:00">2021/09/12</span>
        </a>
        
        <a  class="项目 "
           href="/blog/2021/09/04/project-guide-download-excel/"
           data-tag="项目,guide"
           data-author="pgmanor" >
            <span class="post-title" title="vue和hutool工具实现excel下载">vue和hutool工具实现excel下载</span>
            <span class="post-date" title="2021-09-04 00:00:00">2021/09/04</span>
        </a>
        
        <a  class="项目 "
           href="/blog/2021/09/04/project-guide-param-pass-array/"
           data-tag="项目,guide"
           data-author="pgmanor" >
            <span class="post-title" title="axios参数传数组">axios参数传数组</span>
            <span class="post-date" title="2021-09-04 00:00:00">2021/09/04</span>
        </a>
        
        <a  class="博客 D--数据库 "
           href="/blog/2021/08/15/blog-mysql-backup-cron/"
           data-tag="mysql"
           data-author="pgmanor" >
            <span class="post-title" title="cron定时器">cron定时器</span>
            <span class="post-date" title="2021-08-15 00:00:00">2021/08/15</span>
        </a>
        
        <a  class="博客 D--数据库 "
           href="/blog/2021/08/14/blog-mysql-backup-xtrabackup/"
           data-tag="mysql"
           data-author="pgmanor" >
            <span class="post-title" title="mysql备份-xtrabackup">mysql备份-xtrabackup</span>
            <span class="post-date" title="2021-08-14 00:00:00">2021/08/14</span>
        </a>
        
        <a  class="博客 D--数据库 "
           href="/blog/2021/08/14/blog-mysql-backup-xtrabackup-scripts/"
           data-tag="mysql"
           data-author="pgmanor" >
            <span class="post-title" title="mysql备份-xtrabackup-脚本">mysql备份-xtrabackup-脚本</span>
            <span class="post-date" title="2021-08-14 00:00:00">2021/08/14</span>
        </a>
        
        <a  class="项目 "
           href="/blog/2021/08/08/project-guide-devops-slowquery/"
           data-tag="项目,guide"
           data-author="pgmanor" >
            <span class="post-title" title="SQL慢查询">SQL慢查询</span>
            <span class="post-date" title="2021-08-08 00:00:00">2021/08/08</span>
        </a>
        
        <a  class="博客 D--数据库 "
           href="/blog/2021/08/08/blog-mysql-backup-summary/"
           data-tag="mysql"
           data-author="pgmanor" >
            <span class="post-title" title="mysql备份">mysql备份</span>
            <span class="post-date" title="2021-08-08 00:00:00">2021/08/08</span>
        </a>
        
        <a  class="项目 "
           href="/blog/2021/08/08/project-guide-springboot-upgrade/"
           data-tag="项目,guide"
           data-author="pgmanor" >
            <span class="post-title" title="springboot升级到2.5.x遇到的问题">springboot升级到2.5.x遇到的问题</span>
            <span class="post-date" title="2021-08-08 00:00:00">2021/08/08</span>
        </a>
        
        <a  class="博客 F-----架构 "
           href="/blog/2021/08/07/blog-fw-es-install/"
           data-tag="es"
           data-author="pgmanor" >
            <span class="post-title" title="ElasticSearch安装和使用">ElasticSearch安装和使用</span>
            <span class="post-date" title="2021-08-07 00:00:00">2021/08/07</span>
        </a>
        
        <a  class="项目 "
           href="/blog/2021/08/07/project-guide-log-analysis/"
           data-tag="项目,guide"
           data-author="pgmanor" >
            <span class="post-title" title="日志分析">日志分析</span>
            <span class="post-date" title="2021-08-07 00:00:00">2021/08/07</span>
        </a>
        
        <a  class="项目 "
           href="/blog/2021/08/07/project-guide-devops-monitor/"
           data-tag="项目,guide"
           data-author="pgmanor" >
            <span class="post-title" title="运维监控">运维监控</span>
            <span class="post-date" title="2021-08-07 00:00:00">2021/08/07</span>
        </a>
        
        <a  class="博客 T-----工具 "
           href="/blog/2021/08/01/blog-tool-postman/"
           data-tag="postman"
           data-author="pgmanor" >
            <span class="post-title" title="postman工具使用">postman工具使用</span>
            <span class="post-date" title="2021-08-01 00:00:00">2021/08/01</span>
        </a>
        
        <a  class="博客 T-----工具 "
           href="/blog/2021/08/01/blog-tool-bug-track/"
           data-tag="track"
           data-author="pgmanor" >
            <span class="post-title" title="bug跟踪工具">bug跟踪工具</span>
            <span class="post-date" title="2021-08-01 00:00:00">2021/08/01</span>
        </a>
        
        <a  class="博客 J-----java "
           href="/blog/2021/08/01/blog-java-kill/"
           data-tag="kill"
           data-author="pgmanor" >
            <span class="post-title" title="java项目如何优雅关闭程序">java项目如何优雅关闭程序</span>
            <span class="post-date" title="2021-08-01 00:00:00">2021/08/01</span>
        </a>
        
        <a  class="博客 M--微服务 "
           href="/blog/2021/07/25/blog-spring-boot-logback/"
           data-tag="springboot"
           data-author="pgmanor" >
            <span class="post-title" title="springboot logback多环境">springboot logback多环境</span>
            <span class="post-date" title="2021-07-25 00:00:00">2021/07/25</span>
        </a>
        
        <a  class="博客 W-----前端 "
           href="/blog/2021/06/18/blog-vue-element-admin-keepalive/"
           data-tag="keepavlie"
           data-author="pgmanor" >
            <span class="post-title" title="vue中keep alive失效">vue中keep alive失效</span>
            <span class="post-date" title="2021-06-18 00:00:00">2021/06/18</span>
        </a>
        
        <a  class="博客 J-----java "
           href="/blog/2021/06/14/blog-java-start/"
           data-tag="启动"
           data-author="pgmanor" >
            <span class="post-title" title="java启动方式">java启动方式</span>
            <span class="post-date" title="2021-06-14 00:00:00">2021/06/14</span>
        </a>
        
        <a  class="项目 "
           href="/blog/2021/05/31/project-guide-vue-component/"
           data-tag="项目,guide"
           data-author="pgmanor" >
            <span class="post-title" title="vue封装组件">vue封装组件</span>
            <span class="post-date" title="2021-05-31 00:00:00">2021/05/31</span>
        </a>
        
        <a  class="项目 "
           href="/blog/2021/05/09/project-guide-vue-full-calendar/"
           data-tag="项目,guide"
           data-author="pgmanor" >
            <span class="post-title" title="vue-full-calendar日历">vue-full-calendar日历</span>
            <span class="post-date" title="2021-05-09 00:00:00">2021/05/09</span>
        </a>
        
        <a  class="博客 F-----架构 "
           href="/blog/2021/05/04/blog-redis-local/"
           data-tag="redis"
           data-author="pgmanor" >
            <span class="post-title" title="嵌入redis和可视化界面">嵌入redis和可视化界面</span>
            <span class="post-date" title="2021-05-04 22:48:35">2021/05/04</span>
        </a>
        
        <a  class="博客 T-----工具 "
           href="/blog/2021/03/14/blog-tool-doc/"
           data-tag="doc"
           data-author="pgmanor" >
            <span class="post-title" title="文档工具">文档工具</span>
            <span class="post-date" title="2021-03-14 00:00:00">2021/03/14</span>
        </a>
        
        <a  class="博客 D--数据库 "
           href="/blog/2021/03/14/blog-jpa-anno-generatedValue/"
           data-tag="JPA"
           data-author="pgmanor" >
            <span class="post-title" title="JPA注解@GeneratedValue">JPA注解@GeneratedValue</span>
            <span class="post-date" title="2021-03-14 00:00:00">2021/03/14</span>
        </a>
        
        <a  class="博客 T-----工具 "
           href="/blog/2021/03/14/blog-tool-chrome/"
           data-tag="chrome"
           data-author="pgmanor" >
            <span class="post-title" title="Chrome调试技巧">Chrome调试技巧</span>
            <span class="post-date" title="2021-03-14 00:00:00">2021/03/14</span>
        </a>
        
        <a  class="博客 T-----工具 "
           href="/blog/2021/03/14/blog-vuepress-fulltext-search/"
           data-tag="vuepress"
           data-author="pgmanor" >
            <span class="post-title" title="vuepress支持全文搜索">vuepress支持全文搜索</span>
            <span class="post-date" title="2021-03-14 00:00:00">2021/03/14</span>
        </a>
        
        <a  class="博客 F-----架构 "
           href="/blog/2021/03/07/blog-redis-type-string-sds/"
           data-tag="redis"
           data-author="pgmanor" >
            <span class="post-title" title="Redis为什么将String设计成SDS">Redis为什么将String设计成SDS</span>
            <span class="post-date" title="2021-03-07 00:00:00">2021/03/07</span>
        </a>
        
        <a  class="博客 F-----架构 "
           href="/blog/2021/03/07/blog-redis-fast/"
           data-tag="redis"
           data-author="pgmanor" >
            <span class="post-title" title="Redis为什么这么快">Redis为什么这么快</span>
            <span class="post-date" title="2021-03-07 00:00:00">2021/03/07</span>
        </a>
        
        <a  class="博客 F-----架构 "
           href="/blog/2021/03/07/blog-redis-type-six/"
           data-tag="redis"
           data-author="pgmanor" >
            <span class="post-title" title="Redis的6大数据类型">Redis的6大数据类型</span>
            <span class="post-date" title="2021-03-07 00:00:00">2021/03/07</span>
        </a>
        
        <a  class="博客 微服务 "
           href="/blog/2021/03/06/blog-spring-boot-h2/"
           data-tag="springboot"
           data-author="pgmanor" >
            <span class="post-title" title="springboot整合h2">springboot整合h2</span>
            <span class="post-date" title="2021-03-06 00:00:00">2021/03/06</span>
        </a>
        
        <a  class="博客 J-----java "
           href="/blog/2021/02/28/blog-java-md5/"
           data-tag="uuid"
           data-author="pgmanor" >
            <span class="post-title" title="MD5加密">MD5加密</span>
            <span class="post-date" title="2021-02-28 00:00:00">2021/02/28</span>
        </a>
        
        <a  class="博客 J-----java "
           href="/blog/2021/02/28/blog-java-uuid/"
           data-tag="uuid"
           data-author="pgmanor" >
            <span class="post-title" title="UUID">UUID</span>
            <span class="post-date" title="2021-02-28 00:00:00">2021/02/28</span>
        </a>
        
        <a  class="博客 J-----java "
           href="/blog/2021/02/28/blog-java-base64/"
           data-tag="uuid"
           data-author="pgmanor" >
            <span class="post-title" title="base64加解密">base64加解密</span>
            <span class="post-date" title="2021-02-28 00:00:00">2021/02/28</span>
        </a>
        
        <a  class="博客 J-----java "
           href="/blog/2021/02/27/blog-java-new8-date-opertaion.md/"
           data-tag="LocalDate"
           data-author="pgmanor" >
            <span class="post-title" title="java8日期操作">java8日期操作</span>
            <span class="post-date" title="2021-02-27 00:00:00">2021/02/27</span>
        </a>
        
        <a  class="博客 D--数据库 "
           href="/blog/2021/01/24/blog-jpa-entity-manager/"
           data-tag="JPA"
           data-author="pgmanor" >
            <span class="post-title" title="JPA之EntityManager">JPA之EntityManager</span>
            <span class="post-date" title="2021-01-24 00:00:00">2021/01/24</span>
        </a>
        
        <a  class="博客 D--数据库 "
           href="/blog/2021/01/24/blog-jpa-relationship/"
           data-tag="JPA"
           data-author="pgmanor" >
            <span class="post-title" title="JPA表与表关系映射">JPA表与表关系映射</span>
            <span class="post-date" title="2021-01-24 00:00:00">2021/01/24</span>
        </a>
        
        <a  class="博客 W-----前端 "
           href="/blog/2021/01/24/blog-web-CodeMirror/"
           data-tag="web"
           data-author="pgmanor" >
            <span class="post-title" title="CodeMirror">CodeMirror</span>
            <span class="post-date" title="2021-01-24 00:00:00">2021/01/24</span>
        </a>
        
        <a  class="博客 T-----工具 "
           href="/blog/2021/01/10/blog-vuepress-theme-password/"
           data-tag="vuepress"
           data-author="pgmanor" >
            <span class="post-title" title="vuepress-theme-reco源码密钥修改">vuepress-theme-reco源码密钥修改</span>
            <span class="post-date" title="2021-01-10 00:00:00">2021/01/10</span>
        </a>
        
        <a  class="博客 T-----工具 "
           href="/blog/2021/01/03/blog-tool-encryption/"
           data-tag="加密"
           data-author="pgmanor" >
            <span class="post-title" title="在线加密工具">在线加密工具</span>
            <span class="post-date" title="2021-01-03 10:08:09">2021/01/03</span>
        </a>
        
        <a  class="博客 T-----工具 "
           href="/blog/2021/01/02/blog-tool-jboss-password/"
           data-tag="jboss"
           data-author="pgmanor" >
            <span class="post-title" title="jboss数据库密码加解密">jboss数据库密码加解密</span>
            <span class="post-date" title="2021-01-02 00:00:00">2021/01/02</span>
        </a>
        
        <a  class="博客 T-----工具 "
           href="/blog/2021/01/02/blog-tool-excel-hidden-col/"
           data-tag="excel"
           data-author="pgmanor" >
            <span class="post-title" title="excel隐藏空白列">excel隐藏空白列</span>
            <span class="post-date" title="2021-01-02 00:00:00">2021/01/02</span>
        </a>
        
        <a  class="博客 微服务 "
           href="/blog/2021/01/02/blog-spring-boot-run-withparam-windows/"
           data-tag="springboot"
           data-author="pgmanor" >
            <span class="post-title" title="springboot项目多环境运行报错 windows">springboot项目多环境运行报错 windows</span>
            <span class="post-date" title="2021-01-02 00:00:00">2021/01/02</span>
        </a>
        
        <a  class="农场 算法 "
           href="/blog/2020/12/31/farm-data-structures-algorithms-sort/"
           data-tag="算法"
           data-author="pgmanor" >
            <span class="post-title" title="数据结构和算法8-排序">数据结构和算法8-排序</span>
            <span class="post-date" title="2020-12-31 08:00:00">2020/12/31</span>
        </a>
        
        <a  class="农场 算法 "
           href="/blog/2020/12/31/farm-data-structures-algorithms-search/"
           data-tag="算法"
           data-author="pgmanor" >
            <span class="post-title" title="数据结构和算法7-搜索">数据结构和算法7-搜索</span>
            <span class="post-date" title="2020-12-31 07:00:00">2020/12/31</span>
        </a>
        
        <a  class="农场 算法 "
           href="/blog/2020/12/31/farm-data-structures-algorithms-graph/"
           data-tag="算法"
           data-author="pgmanor" >
            <span class="post-title" title="数据结构和算法6-非线性-图">数据结构和算法6-非线性-图</span>
            <span class="post-date" title="2020-12-31 06:00:00">2020/12/31</span>
        </a>
        
        <a  class="农场 算法 "
           href="/blog/2020/12/31/farm-data-structures-algorithms-tree/"
           data-tag="算法"
           data-author="pgmanor" >
            <span class="post-title" title="数据结构和算法5-非线性-树">数据结构和算法5-非线性-树</span>
            <span class="post-date" title="2020-12-31 05:00:00">2020/12/31</span>
        </a>
        
        <a  class="农场 算法 "
           href="/blog/2020/12/31/farm-data-structures-algorithms-linear-queue/"
           data-tag="算法"
           data-author="pgmanor" >
            <span class="post-title" title="数据结构和算法4-线性-队列">数据结构和算法4-线性-队列</span>
            <span class="post-date" title="2020-12-31 04:00:00">2020/12/31</span>
        </a>
        
        <a  class="农场 算法 "
           href="/blog/2020/12/31/farm-data-structures-algorithms-linear-stack/"
           data-tag="算法"
           data-author="pgmanor" >
            <span class="post-title" title="数据结构和算法3-线性-栈">数据结构和算法3-线性-栈</span>
            <span class="post-date" title="2020-12-31 03:00:00">2020/12/31</span>
        </a>
        
        <a  class="农场 算法 "
           href="/blog/2020/12/31/farm-data-structures-algorithms-linear-list/"
           data-tag="算法"
           data-author="pgmanor" >
            <span class="post-title" title="数据结构和算法2-线性-链">数据结构和算法2-线性-链</span>
            <span class="post-date" title="2020-12-31 02:00:00">2020/12/31</span>
        </a>
        
        <a  class="农场 算法 "
           href="/blog/2020/12/31/farm-data-structures-algorithms-info/"
           data-tag="算法"
           data-author="pgmanor" >
            <span class="post-title" title="数据结构和算法1-介绍">数据结构和算法1-介绍</span>
            <span class="post-date" title="2020-12-31 01:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 D-devops "
           href="/blog/2020/12/31/blog-devops-linux-jfinalshell/"
           data-tag="jfinalshell"
           data-author="pgmanor" >
            <span class="post-title" title="linux连接工具jfinalshell">linux连接工具jfinalshell</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 P-python "
           href="/blog/2020/12/31/blog-python-tool-buildin-func/"
           data-tag="func"
           data-author="pgmanor" >
            <span class="post-title" title="👍python内置函数">👍python内置函数</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 D--数据库 "
           href="/blog/2020/12/31/blog-jpa-query-multi-param/"
           data-tag="JPA"
           data-author="pgmanor" >
            <span class="post-title" title="JPA多条件查询">JPA多条件查询</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 D--数据库 "
           href="/blog/2020/12/31/blog-jpa-query/"
           data-tag="JPA"
           data-author="pgmanor" >
            <span class="post-title" title="JPA自定义sql">JPA自定义sql</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 F-----架构 "
           href="/blog/2020/12/31/blog-fw-mq-message-missing/"
           data-tag="mq,message"
           data-author="pgmanor" >
            <span class="post-title" title="MQ如何保证消息不丢失?">MQ如何保证消息不丢失?</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 B---大数据 "
           href="/blog/2020/12/31/blog-hadoop-install-windows/"
           data-tag="hadoop"
           data-author="pgmanor" >
            <span class="post-title" title="hadoop开发环境搭建">hadoop开发环境搭建</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 D--数据库 "
           href="/blog/2020/12/31/blog-mysql-lock-unlock-table/"
           data-tag="lock"
           data-author="pgmanor" >
            <span class="post-title" title="mysql数据库锁查询和释放">mysql数据库锁查询和释放</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 P-python "
           href="/blog/2020/12/31/blog-ai-python-spark-env/"
           data-tag="spark"
           data-author="pgmanor" >
            <span class="post-title" title="python spark开发环境搭建">python spark开发环境搭建</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 D--数据库 "
           href="/blog/2020/12/31/blog-mysql-windows-zip-install/"
           data-tag="mysql"
           data-author="pgmanor" >
            <span class="post-title" title="mysql zip在windows上安装">mysql zip在windows上安装</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 P-python "
           href="/blog/2020/12/31/blog-python_install/"
           data-tag="python"
           data-author="pgmanor" >
            <span class="post-title" title="python环境安装">python环境安装</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 D-devops "
           href="/blog/2020/12/31/blog-devops-docker-introduction/"
           data-tag="docker"
           data-author="pgmanor" >
            <span class="post-title" title="👍docker入门看这一篇就够了">👍docker入门看这一篇就够了</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 I-----面试 "
           href="/blog/2020/12/31/blog-interview-company/"
           data-tag="面试"
           data-author="pgmanor" >
            <span class="post-title" title="IT互联网公司名单">IT互联网公司名单</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 J-----java "
           href="/blog/2020/12/31/blog-java-base-domain/"
           data-tag="domain"
           data-author="pgmanor" >
            <span class="post-title" title="VO DTO DO PO你都了解吗?">VO DTO DO PO你都了解吗?</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 J-----java "
           href="/blog/2020/12/31/blog-java-base-serializable/"
           data-tag="序列化"
           data-author="pgmanor" >
            <span class="post-title" title="java序列化">java序列化</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 T-----工具 "
           href="/blog/2020/12/31/blog-hexo-theme-math/"
           data-tag="hexo"
           data-author="pgmanor" >
            <span class="post-title" title="hexo主题支持MathJax">hexo主题支持MathJax</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 C-----并发 "
           href="/blog/2020/12/31/blog-java-concurrent-aqs/"
           data-tag="AQS,并发"
           data-author="pgmanor" >
            <span class="post-title" title="java并发AQS">java并发AQS</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 D--数据库 "
           href="/blog/2020/12/31/blog-java-dao-sharding-db/"
           data-tag="分库分表"
           data-author="pgmanor" >
            <span class="post-title" title="分库分表中间件-开源产品">分库分表中间件-开源产品</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 B---大数据 "
           href="/blog/2020/12/31/blog-spark-install-windows/"
           data-tag="spark"
           data-author="pgmanor" >
            <span class="post-title" title="spark开发环境搭建">spark开发环境搭建</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 T-----工具 "
           href="/blog/2020/12/31/blog-jetbrains-crack/"
           data-tag="idea,jetbrains"
           data-author="pgmanor" >
            <span class="post-title" title="jetbrains全家桶破解">jetbrains全家桶破解</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 M--微服务 "
           href="/blog/2020/12/31/blog-spring-boot-multi-profiles/"
           data-tag="springboot"
           data-author="pgmanor" >
            <span class="post-title" title="springboot多环境配置打包">springboot多环境配置打包</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 T-----工具 "
           href="/blog/2020/12/31/blog-markdown-math-express/"
           data-tag="markdown"
           data-author="pgmanor" >
            <span class="post-title" title="markdown数学公式">markdown数学公式</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 I-----面试 "
           href="/blog/2020/12/31/blog-interview-java-question/"
           data-tag="面试"
           data-author="pgmanor" >
            <span class="post-title" title="java常见面试题">java常见面试题</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 F-----架构 "
           href="/blog/2020/12/31/blog-nginx-fast/"
           data-tag="nginx"
           data-author="pgmanor" >
            <span class="post-title" title="nginx为何这么快?">nginx为何这么快?</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 M--微服务 "
           href="/blog/2020/12/31/spring-initialzr/"
           data-tag="工具,initialzr"
           data-author="pgmanor" >
            <span class="post-title" title="spring initialzr环境编译发布">spring initialzr环境编译发布</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 F-----架构 "
           href="/blog/2020/12/31/blog-redis-memory-eliminate/"
           data-tag="redis"
           data-author="pgmanor" >
            <span class="post-title" title="Redis的内存淘汰策略">Redis的内存淘汰策略</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 M--微服务 "
           href="/blog/2020/12/31/blog-spring-pageable/"
           data-tag="分页"
           data-author="pgmanor" >
            <span class="post-title" title="vue+springboot分页交互">vue+springboot分页交互</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 P-python "
           href="/blog/2020/12/31/blog-python_base/"
           data-tag="python"
           data-author="pgmanor" >
            <span class="post-title" title="python基本语法">python基本语法</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 M--微服务 "
           href="/blog/2020/12/31/blog-spring-transaction/"
           data-tag="transactional"
           data-author="pgmanor" >
            <span class="post-title" title="Transactional注解">Transactional注解</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 T-----测试 "
           href="/blog/2020/12/31/blog-test-ng/"
           data-tag="testng"
           data-author="pgmanor" >
            <span class="post-title" title="👍TestNG一篇足以">👍TestNG一篇足以</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 T-----测试 "
           href="/blog/2020/12/31/blog-test-mockito/"
           data-tag="mock"
           data-author="pgmanor" >
            <span class="post-title" title="👍mockito测试框架">👍mockito测试框架</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 T-----测试 "
           href="/blog/2020/12/31/blog-test-powermock/"
           data-tag="powermock"
           data-author="pgmanor" >
            <span class="post-title" title="powermock测试框架">powermock测试框架</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 T-----工具 "
           href="/blog/2020/12/31/blog-tool-blogs-all/"
           data-tag="blog"
           data-author="pgmanor" >
            <span class="post-title" title="优质博客和文章">优质博客和文章</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 W-window "
           href="/blog/2020/12/31/blog-tool-windows-dev-install/"
           data-tag="windows"
           data-author="pgmanor" >
            <span class="post-title" title="windows开发环境安装">windows开发环境安装</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 J-----java "
           href="/blog/2020/12/31/blog-java-base-bigdecimal/"
           data-tag="bigdecimal"
           data-author="pgmanor" >
            <span class="post-title" title="BigDecimal正确使用了吗?">BigDecimal正确使用了吗?</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 W-----前端 "
           href="/blog/2020/12/31/blog-vue-element-admin/"
           data-tag="elementadmin"
           data-author="pgmanor" >
            <span class="post-title" title="vue element admin开发">vue element admin开发</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 M--微服务 "
           href="/blog/2020/12/31/blog-vue-springboot-package-publish/"
           data-tag="springboot"
           data-author="pgmanor" >
            <span class="post-title" title="vue+springboot打包发布">vue+springboot打包发布</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 D--数据库 "
           href="/blog/2020/12/31/blog-java-dao-mycat/"
           data-tag="mycat"
           data-author="pgmanor" >
            <span class="post-title" title="分库分表中间件-MyCat">分库分表中间件-MyCat</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 T-----工具 "
           href="/blog/2020/12/31/blog-tool-connect-github/"
           data-tag="github"
           data-author="pgmanor" >
            <span class="post-title" title="github无法访问解决办法">github无法访问解决办法</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 J-----java "
           href="/blog/2020/12/31/blog-java-install-windows/"
           data-tag="java"
           data-author="pgmanor" >
            <span class="post-title" title="jdk开发环境搭建">jdk开发环境搭建</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 P-python "
           href="/blog/2020/12/31/blog-ai-jupyter-notebook/"
           data-tag="jupyter"
           data-author="pgmanor" >
            <span class="post-title" title="jupyter notebook">jupyter notebook</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 T-----工具 "
           href="/blog/2020/12/31/blog-chrome-plugin/"
           data-tag="chrome"
           data-author="pgmanor" >
            <span class="post-title" title="chrome插件">chrome插件</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 T-----工具 "
           href="/blog/2020/12/31/blog-tool-git-error-name-too-long/"
           data-tag="git"
           data-author="pgmanor" >
            <span class="post-title" title="git文件名太长">git文件名太长</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 T-----工具 "
           href="/blog/2020/12/31/blog-tool-git-setting/"
           data-tag="git"
           data-author="pgmanor" >
            <span class="post-title" title="git配置">git配置</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 P-python "
           href="/blog/2020/12/31/blog-python_tornado_info/"
           data-tag="tornado"
           data-author="pgmanor" >
            <span class="post-title" title="👍Tornado入门这一篇足以">👍Tornado入门这一篇足以</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 T-----工具 "
           href="/blog/2020/12/31/blog-tool-maven/"
           data-tag="maven"
           data-author="pgmanor" >
            <span class="post-title" title="maven常用命令和配置">maven常用命令和配置</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 T-----工具 "
           href="/blog/2020/12/31/blog-tool-notebook-joplin/"
           data-tag="joplin"
           data-author="pgmanor" >
            <span class="post-title" title="joplin笔记">joplin笔记</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 T-----工具 "
           href="/blog/2020/12/31/blog-tool-notebook/"
           data-tag="notebook"
           data-author="pgmanor" >
            <span class="post-title" title="常见笔记软件">常见笔记软件</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 F-----架构 "
           href="/blog/2020/12/31/blog-fw-distributed-lock-redis-zk/"
           data-tag="lock,redis,zookeeper"
           data-author="pgmanor" >
            <span class="post-title" title="分布式锁用redis还是zk?">分布式锁用redis还是zk?</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 D--数据库 "
           href="/blog/2020/12/31/blog-java-dao-shardingSphere/"
           data-tag="sharding-jdbc"
           data-author="pgmanor" >
            <span class="post-title" title="分库分表中间件-ShardingSphere">分库分表中间件-ShardingSphere</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 T-----测试 "
           href="/blog/2020/12/31/blog-test-rest-assured-in-action/"
           data-tag="rest"
           data-author="pgmanor" >
            <span class="post-title" title="rest-assured实战">rest-assured实战</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 F-----架构 "
           href="/blog/2020/12/31/blog-microservice-why/"
           data-tag="微服务"
           data-author="pgmanor" >
            <span class="post-title" title="一定要使用微服务？">一定要使用微服务？</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 J-----java "
           href="/blog/2020/12/31/blog-java-tool-bean-map/"
           data-tag="beanmap"
           data-author="pgmanor" >
            <span class="post-title" title="工具类--bean和map互转">工具类--bean和map互转</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 D--数据库 "
           href="/blog/2020/12/31/blog-mysql-common-sql/"
           data-tag="mysql"
           data-author="pgmanor" >
            <span class="post-title" title="mysql常用sql">mysql常用sql</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 P-python "
           href="/blog/2020/12/31/blog-python-tool-buildin-attr/"
           data-tag="attr"
           data-author="pgmanor" >
            <span class="post-title" title="👍python内置属性(魔法方法)">👍python内置属性(魔法方法)</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 P-python "
           href="/blog/2020/12/31/blog-python-tool-obj-dict/"
           data-tag="dict"
           data-author="pgmanor" >
            <span class="post-title" title="python对象与dict互转">python对象与dict互转</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 J-----java "
           href="/blog/2020/12/31/blog-java-tool-fastjson-bug/"
           data-tag="fastjson"
           data-author="pgmanor" >
            <span class="post-title" title="Fastjson远程代码高危漏洞">Fastjson远程代码高危漏洞</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 B---大数据 "
           href="/blog/2020/12/31/blog-spark-data-skew/"
           data-tag="spark"
           data-author="pgmanor" >
            <span class="post-title" title="spark数据倾斜及解决方案">spark数据倾斜及解决方案</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 B---大数据 "
           href="/blog/2020/12/31/blog-spark-version-3/"
           data-tag="spark"
           data-author="pgmanor" >
            <span class="post-title" title="spark3.0新特性">spark3.0新特性</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 W-window "
           href="/blog/2020/12/31/blog-tool-windows-cmd/"
           data-tag="windows"
           data-author="pgmanor" >
            <span class="post-title" title="windows常用命令和技巧">windows常用命令和技巧</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 W-window "
           href="/blog/2020/12/31/blog-tool-windows-less-dll/"
           data-tag="dll"
           data-author="pgmanor" >
            <span class="post-title" title="windows缺少dll">windows缺少dll</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 T-----工具 "
           href="/blog/2020/12/31/blog-tool-youdao-config-edit/"
           data-tag="有道云"
           data-author="pgmanor" >
            <span class="post-title" title="有道云配置修改">有道云配置修改</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 D--数据库 "
           href="/blog/2020/12/31/blog-java-jndi/"
           data-tag="jdni"
           data-author="pgmanor" >
            <span class="post-title" title="JNDI">JNDI</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 J-----java "
           href="/blog/2020/12/31/blog-java-online-analysis/"
           data-tag="性能分析"
           data-author="pgmanor" >
            <span class="post-title" title="JAVA线上故障排查全套路">JAVA线上故障排查全套路</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 P-python "
           href="/blog/2020/12/31/blog-tornado-sync-to-async/"
           data-tag="aysnc,tornado"
           data-author="pgmanor" >
            <span class="post-title" title="tornado同步转异步">tornado同步转异步</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 J-----java "
           href="/blog/2020/12/31/blog-java-tool-jackson/"
           data-tag="jackson"
           data-author="pgmanor" >
            <span class="post-title" title="工具类--jackson">工具类--jackson</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 T-----测试 "
           href="/blog/2020/12/31/blog-rest-assured-wiki-info/"
           data-tag="rest"
           data-author="pgmanor" >
            <span class="post-title" title="rest-assured wiki翻译">rest-assured wiki翻译</span>
            <span class="post-date" title="2020-12-31 00:00:00">2020/12/31</span>
        </a>
        
        <a  class="博客 T-----工具 "
           href="/blog/2020/12/30/blog-template/"
           data-tag="模板"
           data-author="pgmanor" >
            <span class="post-title" title="hexo博客自定义模板">hexo博客自定义模板</span>
            <span class="post-date" title="2020-12-30 00:00:00">2020/12/30</span>
        </a>
        
        <a  class="博客 T-----工具 "
           href="/blog/2020/12/27/blog-hexo-comments-valine/"
           data-tag="hexo"
           data-author="pgmanor" >
            <span class="post-title" title="hexo扩展评论valine">hexo扩展评论valine</span>
            <span class="post-date" title="2020-12-27 08:59:46">2020/12/27</span>
        </a>
        
        <a  class="博客 D-devops "
           href="/blog/2020/08/15/blog-devops-linux-shell-param/"
           data-tag="linux"
           data-author="pgmanor" >
            <span class="post-title" title="shell 脚本参数解析之getopt和getopts">shell 脚本参数解析之getopt和getopts</span>
            <span class="post-date" title="2020-08-15 00:00:00">2020/08/15</span>
        </a>
        
        <a  class="博客 T-----测试 "
           href="/blog/2020/08/08/blog-test-junit4v5/"
           data-tag="junit"
           data-author="pgmanor" >
            <span class="post-title" title="Junit4和Junit5差异">Junit4和Junit5差异</span>
            <span class="post-date" title="2020-08-08 00:00:00">2020/08/08</span>
        </a>
        
        <a  class="博客 D-devops "
           href="/blog/2020/08/01/blog-devops-linux-command/"
           data-tag="linux"
           data-author="pgmanor" >
            <span class="post-title" title="linux常用命令">linux常用命令</span>
            <span class="post-date" title="2020-08-01 00:00:00">2020/08/01</span>
        </a>
        
        <a  class="博客 D-devops "
           href="/blog/2020/08/01/blog-devops-linux-cmd-adv/"
           data-tag="linux"
           data-author="pgmanor" >
            <span class="post-title" title="linux几个高级命令">linux几个高级命令</span>
            <span class="post-date" title="2020-08-01 00:00:00">2020/08/01</span>
        </a>
        
    </nav>
</div>

    </div>
    <div class="hide-list">
        <div class="semicircle" data-title="切换全屏 快捷键 s">
            <div class="brackets first"><</div>
            <div class="brackets">&gt;</div>
        </div>
    </div>
</aside>
<div class="post">
    <div class="pjax">
        <article id="post-blog/blog-python-tool-buildin-attr" class="article article-type-post" itemscope itemprop="blogPost">
    
        <h1 class="article-title">👍python内置属性(魔法方法)</h1>
    
    <div class="article-meta">
        
        
        <span class="author"><a>pgmanor</a></span>
        
        
        <span class="book">
            
                <a  data-rel="博客">博客</a>/
            
                <a  data-rel="P-python">P-python</a>
            
        </span>
        
        
        <span class="tag">
            
            <a class="color5">attr</a>
            
        </span>
        
    </div>
    <div class="article-meta">
        
            发布时间 : <time class="date" title='最后更新: 2020-12-15 23:12:18'>2020-12-31 00:00</time>
        
    </div>
    <div class="article-meta">
        
        <span>字数:3.4k</span>
        
        
        <span id="busuanzi_container_page_pv">
            阅读 :<span id="busuanzi_value_page_pv">
                <span class="count-comment">
                    <span class="spinner">
                      <div class="cube1"></div>
                      <div class="cube2"></div>
                    </span>
                </span>
            </span>
        </span>
        
        
        <span class="top-comment" title="跳转至评论区">
            <a href="#comments">
                评论:<span class="count-comment">
                    <span class="spinner">
                      <div class="cube1"></div>
                      <div class="cube2"></div>
                    </span>
                </span>
            </a>
        </span>
        
    </div>
    
    <div class="toc-ref">
    
        <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#1-属性表格"><span class="toc-text">1.属性表格</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2-object"><span class="toc-text">2.object</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#2-1-init"><span class="toc-text">2-1.init</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-2-new"><span class="toc-text">2-2.new</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-3-str"><span class="toc-text">2-3.str</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-4-doc"><span class="toc-text">2-4.doc</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-5-dict"><span class="toc-text">2-5.dict</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-6-getattribute"><span class="toc-text">2-6.getattribute</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-7-name"><span class="toc-text">2-7.name</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-8-属性操作"><span class="toc-text">2-8.属性操作</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-9-call"><span class="toc-text">2-9.call</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-10-repr"><span class="toc-text">2-10.repr</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-11-比较"><span class="toc-text">2-11.比较</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#3-list"><span class="toc-text">3.list</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#3-1-添加"><span class="toc-text">3-1.添加</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-2-包含"><span class="toc-text">3-2.包含</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-3-元素操作"><span class="toc-text">3-3.元素操作</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-4-迭代"><span class="toc-text">3-4.迭代</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-5-重复"><span class="toc-text">3-5.重复</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-6-len"><span class="toc-text">3-6.len</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#4-总结"><span class="toc-text">4.总结</span></a></li></ol>
    
<style>
    .left-col .switch-btn,
    .left-col .switch-area {
        display: none;
    }
    .toc-level-4 i,
    .toc-level-4 ol {
        display: none !important;
    }
</style>
</div>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>本编研究下python的内置属性(函数<a href="https://iworkh.gitee.io/blog/2020/06/24/python-tool-buildin-func/" target="_blank" rel="noopener">上一篇</a>已研究)</p>
<blockquote>
<p>这里说的内置属性，是指<code>__xxx__</code>的方法和属性，有的地方也称为魔法方法，叫法不一样。</p>
</blockquote>
<h2 id="1-属性表格"><a href="#1-属性表格" class="headerlink" title="1.属性表格"></a>1.属性表格</h2><table>
<thead>
<tr>
<th>常用专有属性</th>
<th>说明</th>
<th>触发方式</th>
</tr>
</thead>
<tbody><tr>
<td><code>__init__</code></td>
<td>构造初始化函数</td>
<td>创建实例后,赋值时使用,在<code>__new__</code>后</td>
</tr>
<tr>
<td><code>__new__</code></td>
<td>生成实例所需属性</td>
<td>创建实例时</td>
</tr>
<tr>
<td><code>__class__</code></td>
<td>实例所在的类</td>
<td>实例.<code>__class__</code></td>
</tr>
<tr>
<td><code>__str__</code></td>
<td>实例字符串表示,可读性</td>
<td>print(类实例),如没实现，使用repr结果</td>
</tr>
<tr>
<td><code>__repr__</code></td>
<td>实例字符串表示,准确性</td>
<td>类实例 回车 或者 print(repr(类实例))</td>
</tr>
<tr>
<td><code>__del__</code></td>
<td>析构</td>
<td>del删除实例</td>
</tr>
<tr>
<td><code>__dict__</code></td>
<td>实例自定义属性</td>
<td><code>vars(实例.__dict__)</code></td>
</tr>
<tr>
<td><code>__doc__</code></td>
<td>类文档,子类不继承</td>
<td>help(类或实例)</td>
</tr>
<tr>
<td><code>__getattribute__</code></td>
<td>属性访问拦截器</td>
<td>访问实例属性时</td>
</tr>
<tr>
<td><code>__delattr__(s,name)</code></td>
<td>删除name属性</td>
<td>调用时</td>
</tr>
<tr>
<td><code>__gt__(self,other)</code></td>
<td>判断self对象是否大于other对</td>
<td>调用时</td>
</tr>
<tr>
<td><code>__setattr__(s,name,value)</code></td>
<td>设置name属性</td>
<td>调用时</td>
</tr>
<tr>
<td><code>__gt__(self,other)</code></td>
<td>判断self对象是否大于other对象</td>
<td>调用时</td>
</tr>
<tr>
<td><code>__lt__(slef,other)</code></td>
<td>判断self对象是否小于other对象</td>
<td>调用时</td>
</tr>
<tr>
<td><code>__ge__(slef,other)</code></td>
<td>判断self对象是否大于或者等于other对象</td>
<td>调用时</td>
</tr>
<tr>
<td><code>__le__(slef,other)</code></td>
<td>判断self对象是否小于或者等于other对象</td>
<td>调用时</td>
</tr>
<tr>
<td><code>__eq__(slef,other)</code></td>
<td>判断self对象是否等于other对象</td>
<td>调用时</td>
</tr>
<tr>
<td><code>__call__(self,\*args)</code></td>
<td>把实例对象作为函数调用</td>
<td>调用时</td>
</tr>
</tbody></table>
<p>下面分别以object和list的内置属性(魔法方法)来讲解下，其他的有需要的可以留言补充。</p>
<h2 id="2-object"><a href="#2-object" class="headerlink" title="2.object"></a>2.object</h2><blockquote>
<p>使用<code>dir()</code>函数来可以打印出有哪些属性，下面会挑一些常用的演示</p>
</blockquote>
<p><strong>演示</strong></p>
<pre><code class="python">class People:
    name: str

class MyTestCase(unittest.TestCase):
    def test_attr(self):
       print(dir(People))</code></pre>
<p><a href="https://gitee.com/iworkh/iworkh-dev-python/tree/develop/code/python_test/test03" target="_blank" rel="noopener">源码坐标</a></p>
<blockquote>
<p>如需要源码，可以查看。(关键代码都贴在文章里，不用看也行)</p>
</blockquote>
<h3 id="2-1-init"><a href="#2-1-init" class="headerlink" title="2-1.init"></a>2-1.init</h3><p>初始化时，调用<code>__init__</code>方法</p>
<p><strong>演示</strong></p>
<pre><code class="python">class People:
    name: str = &#39;iworkh&#39;

    def __init__(self, name):
        print(&#39;call...__init__&#39;)
        self.name = name


class MyTestCase(unittest.TestCase):

    def test(self):
        people = People(&#39;pgmanor&#39;) # 创建对象时，调用__init__
        print(people.name)</code></pre>
<h3 id="2-2-new"><a href="#2-2-new" class="headerlink" title="2-2.new"></a>2-2.new</h3><p><code>__ new__ ()</code>在<code>__ init__()</code>之前被调用，用于生成实例对象.</p>
<blockquote>
<p>利用这个方法和类属性的特性可以实现设计模式中的单例模式.单例模式是指创建唯一对象吗，单例模式设计的类只能实例化一个对象.</p>
</blockquote>
<p><strong>演示</strong></p>
<pre><code class="python">class People:
    name: str = &#39;iworkh&#39;

    def __new__(cls, *args, **kwargs):
        print(&#39;call...__new__&#39;)
        obj = object.__new__(cls)
        return obj

    def __init__(self, name):
        print(&#39;call...__init__&#39;)
        self.name = name


class MyTestCase(unittest.TestCase):

    def test(self):
        people = People(&#39;pgmanor&#39;)  # 创建对象先调用__new__，初始化时调用__init__
        print(people.name)</code></pre>
<h3 id="2-3-str"><a href="#2-3-str" class="headerlink" title="2-3.str"></a>2-3.str</h3><p><code>__ str__ ()</code>用于表示对象代表的含义，返回一个字符串.实现了<code>__ str__ ()</code>方法.</p>
<ul>
<li>可以直接使用print语句输出对象，</li>
<li>可以通过函数str()触发<code>__ str__ ()</code>的执行.这样就把对象和字符串关联起来，便于某些程序的实现，可以用这个字符串来表示某个类</li>
</ul>
<p><strong>演示</strong></p>
<pre><code class="python">class People:
    name: str = &#39;iworkh&#39;
    age: int = 20

    def __str__(self) -&gt; str:
        print(&quot;call...__str__&quot;)
        return &quot;{{'name': {}, 'age': {}}}&quot;.format(self.name, self.age)


class MyTestCase(unittest.TestCase):
    def test(self):
        people = People()
        print(people) # {&#39;name&#39;: iworkh, &#39;age&#39;: 20}
        print(str(people)) # {&#39;name&#39;: iworkh, &#39;age&#39;: 20}
</code></pre>
<h3 id="2-4-doc"><a href="#2-4-doc" class="headerlink" title="2-4.doc"></a>2-4.doc</h3><p>类文档,子类不会继承</p>
<blockquote>
<p>help(类或实例)会触发</p>
</blockquote>
<p><strong>演示</strong></p>
<pre><code class="python">class People:
    &quot;&quot;&quot;
    人
    &quot;&quot;&quot;
    name: str = &#39;iworkh&#39;
    age: int = 20

    def say(self):
        &quot;&quot;&quot;
        say method
        &quot;&quot;&quot;
        print(&#39;say&#39;)


class MyTestCase(unittest.TestCase):
    def test(self):
        people = People()
        print(People.__doc__)  # 类： 人
        print(people.__doc__)  # 对象：人
        print(People.say.__doc__)  # 类：say method
        print(people.say.__doc__)  # 对象：say method
        print(help(People.say))  # 类：say method</code></pre>
<h3 id="2-5-dict"><a href="#2-5-dict" class="headerlink" title="2-5.dict"></a>2-5.dict</h3><p>实例自定义属性，只有<code>_init__</code>和通过<code>对象.xxx</code>赋值的属性，才会显示</p>
<blockquote>
<p><code>vars(实例)</code>会触发</p>
</blockquote>
<p><strong>演示</strong></p>
<pre><code class="python">class People:
    name: str = &#39;iworkh&#39;
    age: int = 20
    admin: bool = True

    def __init__(self):
        self.admin = False

class MyTestCase(unittest.TestCase):
    def test(self):
        peo = People()
        print(peo.__dict__)  # {&#39;admin&#39;: False}，只有init和塞值的才会显示
        print(vars(peo))  # {&#39;admin&#39;: False}
        # 塞值后
        peo.name = &#39;pgmanor&#39;
        print(peo.__dict__)  # 对象的__dict__ , {&#39;admin&#39;: False, &#39;name&#39;: &#39;pgmanor&#39;}
        print(vars(peo))  # {&#39;admin&#39;: False, &#39;name&#39;: &#39;pgmanor&#39;}
        print(People.__dict__)  # 类的__dict__, 很多，还包括__和自己定义的
</code></pre>
<h3 id="2-6-getattribute"><a href="#2-6-getattribute" class="headerlink" title="2-6.getattribute"></a>2-6.getattribute</h3><p>属性访问拦截器</p>
<p><strong>演示</strong></p>
<pre><code class="python">class People:
    name: str = &#39;iworkh&#39;
    password = &#39;iworkh123&#39;
    age: int = 20

    def __getattribute__(self, item):
        print(&quot;call .... __getattribute__&quot;)
        if item == &#39;password&#39;:
            return &#39;保密&#39;
        else:
            return object.__getattribute__(self, item)


class MyTestCase(unittest.TestCase):
    def test(self):
        peo = People()
        print(peo.name)  # iworkh
        print(peo.password)  # 保密</code></pre>
<div class="admonition attention">
<p class="fa admonition-title">警告</p>
<p>
    不要在<code>__getattribute__</code>方法中调用self.xxxx，会死循环，而应该使用<code>object.__getattribute__(self, item)</code>
</p>
</div>

<h3 id="2-7-name"><a href="#2-7-name" class="headerlink" title="2-7.name"></a>2-7.name</h3><p><code>__name__</code> 返回类名</p>
<p><strong>演示</strong></p>
<pre><code class="python">class People:
    name: str = &#39;iworkh&#39;


class MyTestCase(unittest.TestCase):

    def test_name(self):
        print(People.__name__)  # 类 People</code></pre>
<h3 id="2-8-属性操作"><a href="#2-8-属性操作" class="headerlink" title="2-8.属性操作"></a>2-8.属性操作</h3><p>属性操作，无非就塞值、取值、删除属性</p>
<ul>
<li><code>__setattr__</code>  设置属性，设置属性值时，触发这个方法 (<code>对象.属性</code>, <code>setattr</code>)</li>
<li><code>__getattr__</code> 取属性，当<strong>属性不存在</strong>时，才会触发这个方法(<code>对象.属性</code>,<code>getattr</code>)</li>
<li><code>__delattr__</code> 删除属性，删除属性值时，触发这个方法(delattr, del)</li>
</ul>
<p><strong>演示</strong></p>
<pre><code class="python">class People:
    name: str = &#39;iworkh&#39;
    password = &#39;iworkh123&#39;

    def __getattr__(self, item):
        print(&#39;call...__getattr__&#39;)
        return &#39;no attribute&#39;

    def __delattr__(self, item):
        print(&#39;call...__delattr__&#39;)
        object.__delattr__(self, item)

    def __setattr__(self, key, value):
        print(&#39;call...__setattr__&#39;)
        object.__setattr__(self, key, value)


class MyTestCase(unittest.TestCase):
    def test(self):
        peo = People()
        setattr(peo, &#39;name&#39;, &#39;pgmanor&#39;)  # 塞值
        # 取值
        print(peo.name)  # 存在， 不会触发__getattr__
        print(peo.sex)  # 不存在，调用 __getattr__
        print(getattr(peo, &#39;name&#39;))  # 存在， getattr方式 不会触发__getattr__
        print(getattr(peo, &#39;sex&#39;))  # 不存在，getattr方式 调用 __getattr__
        # 删除
        peo.password = &quot;test_password&quot;  # 塞值
        del peo.password
        delattr(peo, &#39;name&#39;)
</code></pre>
<h3 id="2-9-call"><a href="#2-9-call" class="headerlink" title="2-9.call"></a>2-9.call</h3><p>定义<code>__call__</code>类实例对象可以像调用普通函数那样，以<code>对象名()</code>的形式使用。</p>
<p>关于call的可以阅读下这篇文章： <a href="https://www.jianshu.com/p/e1d95c4e1697" target="_blank" rel="noopener">Python <strong>call</strong>详解</a></p>
<p><strong>演示</strong></p>
<pre><code class="python">class People:
    name: str = &#39;iworkh&#39;
    age: int = 20

    def __call__(self, **kwargs):
        print(&#39;call...__call__&#39;)
        self.name = kwargs[&#39;name&#39;]
        self.age = kwargs[&#39;age&#39;]


class MyTestCase(unittest.TestCase):
    def test(self):
        peo1 = People()
        print(peo1.name, peo1.age, sep=&quot;......&quot;) # iworkh......20
        peo1(name=&#39;pgmanor&#39;, age=22) # 通过对象()方式就能修改值
        print(peo1.name, peo1.age, sep=&quot;......&quot;) # pgmanor......22</code></pre>
<p><strong>思考：</strong><br>如何取得类/对中所有属性或者方法?</p>
<blockquote>
<ul>
<li><code>dir</code>：属性和方法都拿到</li>
<li><code>hasattr</code>: 属性和方法都拿到</li>
<li><code>callable</code>: 属性为False, 函数和方法是True</li>
</ul>
</blockquote>
<p>这有实现好的例子 <a href="https://iworkh.gitee.io/blog/2020/06/24/python-tool-obj-dict/" target="_blank" rel="noopener">python对象与dict互转</a></p>
<blockquote>
<p>里面的<code>obj_dict_tool.py</code>类的<code>to_dic</code>方法</p>
</blockquote>
<p>还可以看下这篇文章<a href="http://c.biancheng.net/view/2380.html" target="_blank" rel="noopener">call方法</a>，使用了<code>__call__</code>方式</p>
<h3 id="2-10-repr"><a href="#2-10-repr" class="headerlink" title="2-10.repr"></a>2-10.repr</h3><p><code>print</code>的类如果没有<code>__str__</code>,那么就会调用<code>__repr__</code>的</p>
<p><strong>演示</strong></p>
<pre><code class="python">class People:
    name: str = &#39;iworkh&#39;
    age: int = 20

    def __str__(self) -&gt; str:
        print(&quot;call...__str__&quot;)
        return &quot;str --&gt; {{'name': {}, 'age': {}}}&quot;.format(self.name, self.age)

    def __repr__(self):
        print(&quot;call...__repr__&quot;)
        return &quot;repr --&gt; {{'name': {}, 'age': {}}}&quot;.format(self.name, self.age)


class MyTestCase(unittest.TestCase):
    def test(self):
        people = People()
        print(people)
        print(str(people))
</code></pre>
<blockquote>
<p>将<code>__str__</code>代码注释后再试下</p>
</blockquote>
<h3 id="2-11-比较"><a href="#2-11-比较" class="headerlink" title="2-11.比较"></a>2-11.比较</h3><p>对象与对象比较时，得需要比较的方法才能判断出大小，需要实现下面一些方法</p>
<ul>
<li><code>__lt__</code>: 小于 <code>&lt;</code></li>
<li><code>__gt__</code>： 大于 <code>&gt;</code> </li>
<li><code>__le__</code>： 小于等于 <code>&lt;=</code></li>
<li><code>__ge__</code>： 大于等于 <code>&gt;=</code></li>
<li><code>__eq__</code>: 等于 <code>=</code></li>
</ul>
<blockquote>
<p>当只定义了一个小于，没有定义大于时。在使用时也可以使用大于，会根据小于结果取反的。</p>
</blockquote>
<p><strong>演示</strong></p>
<pre><code class="python">class People:
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def __le__(self, other):
        print(&#39;call ... le&#39;)
        return self.age &lt;= other.age


class MyTestCase(unittest.TestCase):
    def test(self):
        people_san = People(&#39;三哥&#39;, 30)
        people_three = People(&#39;张三&#39;, 30)
        people_four = People(&#39;李四&#39;, 40)
        people_five = People(&#39;王五&#39;, 50)
        print(people_three &lt;= people_four) # True
        print(people_five &gt;= people_three) # True
        print(people_san &gt;= people_three) # True
        print(people_san &lt;= people_three) # True
        print(people_three &gt;= people_four) # False</code></pre>
<h2 id="3-list"><a href="#3-list" class="headerlink" title="3.list"></a>3.list</h2><p>我们再来看下list的一些属性</p>
<table>
<thead>
<tr>
<th>属性</th>
<th>说明</th>
</tr>
</thead>
<tbody><tr>
<td><code>__add__</code></td>
<td><code>+</code>,返回一个新列表</td>
</tr>
<tr>
<td><code>__iadd__</code></td>
<td><code>+=</code>,原列表上操作</td>
</tr>
<tr>
<td><code>__contains__</code></td>
<td><code>in</code>,定义当使用成员测试运算符（in 或 not in）时的行为</td>
</tr>
<tr>
<td><code>__delitem__</code></td>
<td>定义删除容器中指定元素的行为</td>
</tr>
<tr>
<td><code>__getitem__</code></td>
<td>定义获取容器中指定元素的行为</td>
</tr>
<tr>
<td><code>__setitem__</code></td>
<td>定义设置容器中指定元素的行为</td>
</tr>
<tr>
<td><code>__iter__</code></td>
<td><code>for</code>定义当迭代容器中的元素的行为</td>
</tr>
<tr>
<td><code>__next__</code></td>
<td><code>for</code>定义当迭代容器中的元素的行为</td>
</tr>
<tr>
<td><code>__len__</code></td>
<td>定义当被 len() 调用时的行为</td>
</tr>
<tr>
<td><code>__mul__</code></td>
<td>乘触发，返回新列表</td>
</tr>
<tr>
<td><code>__rmul__</code></td>
<td>乘触发，右操作符，返回新列表</td>
</tr>
<tr>
<td><code>__imul__</code></td>
<td>乘触发,改变自己</td>
</tr>
<tr>
<td><code>append</code></td>
<td>在列表后面追加元素</td>
</tr>
<tr>
<td><code>extend</code></td>
<td>在列表后面追加另一个列表的元素</td>
</tr>
<tr>
<td><code>insert</code></td>
<td>指定位置插入元素</td>
</tr>
<tr>
<td><code>copy</code></td>
<td>复制</td>
</tr>
<tr>
<td><code>count</code></td>
<td><code>list.count(data)</code> 统计列表中出现data的次数</td>
</tr>
<tr>
<td><code>index</code></td>
<td><code>list.count(data)</code> 列表中元素的索引</td>
</tr>
<tr>
<td><code>pop</code></td>
<td><code>list.pop(index)</code> 弹出指定位置的元素</td>
</tr>
<tr>
<td><code>remove</code></td>
<td><code>list.remove(obj)</code> 删除列表中指定元素</td>
</tr>
<tr>
<td><code>clear</code></td>
<td>清空list</td>
</tr>
<tr>
<td><code>reverse</code></td>
<td>列表元素倒序输出</td>
</tr>
<tr>
<td><code>sort</code></td>
<td><code>list.sort(reverse=False)</code>列表元素升序</td>
</tr>
</tbody></table>
<blockquote>
<p>下面只演示模仿方法</p>
</blockquote>
<blockquote>
<p>使用<code>dir()</code>函数来可以打印出有哪些属性，下面会挑一些常用的演示</p>
</blockquote>
<p><strong>演示</strong></p>
<pre><code class="python">class MyTestCase(unittest.TestCase):
    def test_attr(self):
        print(dir([1,2,3]))</code></pre>
<p>下面就来演示几个常用的魔法方法，以Alphabet类为例子，里面有个data属性为list类型，来存字母。</p>
<p><a href="https://gitee.com/iworkh/iworkh-dev-python/tree/develop/code/python_test/test04" target="_blank" rel="noopener">源码坐标</a></p>
<blockquote>
<p>如需要源码，可以查看。(关键代码都贴在文章里，不用看也行)</p>
</blockquote>
<h3 id="3-1-添加"><a href="#3-1-添加" class="headerlink" title="3-1.添加"></a>3-1.添加</h3><p><code>__add__</code> : 和<code>+</code>操作符对应，对象与对象相加，返回一个新列<br><code>__iadd__</code>: 和<code>+=</code>操作符对应，添加一个元素，在原列表上操作</p>
<p><strong>演示</strong></p>
<pre><code class="python">class Alphabet:
    data = []

    def __init__(self, value) -&gt; None:
        self.data = value

    def __add__(self, other):
        print(&#39;call...__add__&#39;)
        return Alphabet(self.data + other.data)

    def __iadd__(self, other):
        print(&quot;call...__iadd__&quot;)
        self.data += other
        return self

class MyTestCase(unittest.TestCase):
    def test(self):
        list_data = [&#39;a&#39;, &#39;c&#39;, &#39;d&#39;]
        alphabet = Alphabet(list_data)
        print(alphabet.data)
        print(&quot;*&quot; * 50)
        # + 与 __add__
        alphabet_add = Alphabet([&#39;m&#39;, &#39;n&#39;])
        alphabet_sum = alphabet + alphabet_add  # 返回一个新的对象
        print(alphabet.data)  # 原来的没有变 [&#39;a&#39;, &#39;c&#39;, &#39;d&#39;]
        print(alphabet_sum.data)  # [&#39;a&#39;, &#39;c&#39;, &#39;d&#39;, &#39;m&#39;, &#39;n&#39;]
        print(&quot;*&quot; * 50)
        # += 与 __iadd__
        alphabet += &#39;x&#39;
        print(alphabet.data) # 在原对象上操作 [&#39;a&#39;, &#39;c&#39;, &#39;d&#39;, &#39;x&#39;]</code></pre>
<h3 id="3-2-包含"><a href="#3-2-包含" class="headerlink" title="3-2.包含"></a>3-2.包含</h3><p><code>__contains__</code>：是否包含</p>
<p><strong>演示</strong></p>
<pre><code class="python">class Alphabet:
    data = []

    def __init__(self, value) -&gt; None:
        self.data = value

    def __contains__(self, item):
        print(&quot;call...__contains__&quot;)
        return item in self.data


class MyTestCase(unittest.TestCase):
    def test(self):
        list_data = [&#39;a&#39;, &#39;c&#39;, &#39;d&#39;]
        alphabet = Alphabet(list_data)
        print(alphabet.data)
        print(&#39;a&#39; in alphabet) # True
        print(&#39;x&#39; in alphabet) # False</code></pre>
<h3 id="3-3-元素操作"><a href="#3-3-元素操作" class="headerlink" title="3-3.元素操作"></a>3-3.元素操作</h3><p><code>__getitem__</code>：取得元素<br><code>__setitem__</code>：设置元素<br><code>__delitem__</code>：删除元素</p>
<p><strong>演示</strong></p>
<pre><code class="python">class Alphabet:
    data = []

    def __init__(self, value) -&gt; None:
        self.data = value

    def __getitem__(self, index):
        print(&#39;call...__getitem__&#39;)
        return self.data[index]

    def __setitem__(self, key, value):
        print(&#39;call...__setitem__&#39;)
        self.data[key] = value

    def __delitem__(self, key):
        print(&quot;call...__delitem__&quot;)
        delattr(self, key)


class MyTestCase(unittest.TestCase):
    def test(self):
        list_data = [&#39;a&#39;, &#39;c&#39;, &#39;d&#39;]
        alphabet = Alphabet(list_data)
        print(alphabet.data)
        print(&quot;*&quot; * 30) # [&#39;a&#39;, &#39;c&#39;, &#39;d&#39;]
        # 取值
        print(alphabet[1])  # c 取值 会触发__getitem__
        # 设置值
        alphabet[1] = &#39;b&#39;  # 设值 会触发__setitem__
        print(alphabet.data) # [&#39;a&#39;, &#39;b&#39;, &#39;d&#39;]
        # 删除
        del alphabet[&#39;data&#39;]  # 删除 等价于 delattr(alphabet, &#39;data&#39;)  会触发__delitem__
        print(alphabet.data) # []</code></pre>
<h3 id="3-4-迭代"><a href="#3-4-迭代" class="headerlink" title="3-4.迭代"></a>3-4.迭代</h3><p><code>__iter__</code>：迭代器，返回自己，然后for可以循环调用next方法<br><code>__next__</code>: 每一次for循环都调用该方法（必须存在）</p>
<p><strong>演示</strong></p>
<pre><code class="python">class Alphabet:
    data = []
    index = -1

    def __init__(self, value) -&gt; None:
        self.data = value

    def __iter__(self):
        print(&quot;call...__iter__&quot;)
        return self

    def __next__(self):
        print(&quot;call...__next__&quot;)
        self.index += 1
        if self.index &gt;= len(self.data):
            raise StopIteration()
        else:
            return self.data[self.index]


class MyTestCase(unittest.TestCase):
    def test(self):
        list_data = [&#39;a&#39;, &#39;c&#39;, &#39;d&#39;]
        alphabet = Alphabet(list_data)
        print(alphabet.data)
        # for循环 和 __iter__ 以及 __next__配合
        for item in alphabet:
            print(item)</code></pre>
<h3 id="3-5-重复"><a href="#3-5-重复" class="headerlink" title="3-5.重复"></a>3-5.重复</h3><p><code>__mul__</code>: 左操作符相乘,返回新的list，原list不变<br><code>__rmul__</code>: 右操作符相乘，返回新的list，原list不变<br><code>__imul__</code>: 改变原list</p>
<p><strong>演示</strong></p>
<pre><code class="python">class Alphabet:
    data = []

    def __init__(self, value) -&gt; None:
        self.data = value

    def __mul__(self, other):
        print(&quot;call...__mul__&quot;)
        return Alphabet(self.data * other)

    def __rmul__(self, other):
        print(&quot;call...__rmul__&quot;)
        return Alphabet(other * self.data)

    def __imul__(self, other):
        print(&quot;call...__imul__&quot;)
        return self.data * other


class MyTestCase(unittest.TestCase):
    def test(self):
        list_data = [&#39;a&#39;, &#39;c&#39;, &#39;d&#39;]
        alphabet = Alphabet(list_data)
        print(alphabet.data)
        # __mul__
        alphabet_3 = alphabet * 3
        print(alphabet.data)
        print(alphabet_3.data)  # [&#39;a&#39;, &#39;c&#39;, &#39;d&#39;, &#39;a&#39;, &#39;c&#39;, &#39;d&#39;, &#39;a&#39;, &#39;c&#39;, &#39;d&#39;]
        print(&quot;*&quot; * 50)
        # __rmul__
        alphabet_r3 = 3 * alphabet
        print(alphabet.data)
        print(alphabet_r3.data)  # [&#39;a&#39;, &#39;c&#39;, &#39;d&#39;, &#39;a&#39;, &#39;c&#39;, &#39;d&#39;, &#39;a&#39;, &#39;c&#39;, &#39;d&#39;]
        print(&quot;*&quot; * 50)
        # __imul__
        alphabet *= 3  # 改变了原对象
        print(alphabet)  # [&#39;a&#39;, &#39;c&#39;, &#39;d&#39;, &#39;a&#39;, &#39;c&#39;, &#39;d&#39;, &#39;a&#39;, &#39;c&#39;, &#39;d&#39;]</code></pre>
<h3 id="3-6-len"><a href="#3-6-len" class="headerlink" title="3-6.len"></a>3-6.len</h3><p><code>__len__</code>: 这个简单，但调用<code>len(obj)</code>会触发</p>
<p><strong>演示</strong></p>
<pre><code class="python">class Alphabet:
    data = []

    def __init__(self, value) -&gt; None:
        self.data = value

    def __len__(self):
        return len(self.data)


class MyTestCase(unittest.TestCase):
    def test(self):
        list_data = [&#39;a&#39;, &#39;c&#39;, &#39;d&#39;]
        alphabet = Alphabet(list_data)
        print(len(alphabet)) # 3</code></pre>
<h2 id="4-总结"><a href="#4-总结" class="headerlink" title="4.总结"></a>4.总结</h2><p>内置属性(魔法方法)还有很多，只要记得一些常用的即可。</p>
<p><strong>思考</strong></p>
<ul>
<li>1.<code>__init__</code>和<code>__new__</code>的顺序、使用</li>
<li>2.<code>__getattribute__</code>干嘛的?</li>
<li>3.<code>__call__</code>作用，与<code>callable</code>内置函数有着怎样的关系呢？</li>
<li>4.对象如何才能比较? <code>__lt__</code>、<code>__gt__</code>等</li>
<li>5.<code>__getattr__</code>、<code>__setattr__</code>、<code>__delattr__</code>何时触发？</li>
<li>6.<code>__add__</code>与<code>__iadd__</code>区别，何时触发(<code>+</code>、<code>+=</code>)？什么时候会改变自身，什么时候会新建对象？</li>
<li>7.<code>__getitem__</code>、<code>__setitem__</code>、<code>__delitem__</code>何时触发？</li>
<li>8.迭代<code>__iter__</code>、<code>__next__</code>与<code>for-in</code>循环的配合</li>
<li>9.<code>__mul__</code>、<code>__rmul__</code>、<code>__imul__</code>何时触发？什么时候会改变自身，什么时候会新建对象？</li>
</ul>
<p>如果上面几个问题能过回答上，那么恭喜您，本节内容的精髓您都掌握了。</p>
<p>到这内置函数和内置属性(魔法方法)都介绍完了，记得要配合 <a href="https://iworkh.gitee.io/blog/2020/06/24/python-tool-buildin-func/" target="_blank" rel="noopener">内置函数</a>一起学习哦</p>

      
       <hr><span style="font-style: italic;color: gray;"> 转载请注明来源，欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论，也可以邮件至 pgmanor@qq.com </span>
    </div>
</article>


<p>
    <a  class="dashang" onclick="dashangToggle()">赏</a>
</p>


<div class="article_copyright">
    <p><span class="copy-title">文章标题:</span>👍python内置属性(魔法方法)</p>
    <p><span class="copy-title">字数:</span><span class="post-count">3.4k</span></p>
    <p><span class="copy-title">本文作者:</span><a  title="pgmanor">pgmanor</a></p>
    <p><span class="copy-title">发布时间:</span>2020-12-31, 00:00:00</p>
    <p><span class="copy-title">最后更新:</span>2020-12-15, 23:12:18</p>
    <span class="copy-title">原始链接:</span><a class="post-url" href="/blog/2020/12/31/blog-python-tool-buildin-attr/" title="👍python内置属性(魔法方法)">https://pgmanor.gitee.io/blog/2020/12/31/blog-python-tool-buildin-attr/</a>
    <p>
        <span class="copy-title">版权声明:</span><i class="fa fa-creative-commons"></i> <a rel="license noopener" href="http://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank" title="CC BY-NC-SA 4.0 International" target = "_blank">&#34;署名-非商用-相同方式共享 4.0&#34;</a> 转载请保留原文链接及作者。
    </p>
</div>



    <div id="comments"></div>

<script src="/blog/js/valine.min.js"></script>

<script type="text/javascript">
    new Valine({
        el: '#comments',
        appId: 'g5VDso59rLvb68pq56BNnQ7A-gzGzoHsz',
        appKey: '2bebBs4aVT95Btj4j9zJve2O',
        placeholder: '说点什么...',
        avatar: 'monsterid',
        visitor : 'false'
    })
</script>




    




    </div>
    <div class="copyright">
        <p class="footer-entry">©2021 pgmanor</p>
<!--<p class="footer-entry">Built with <a href="https://hexo.io/" target="_blank">Hexo</a> and <a href="https://github.com/yelog/hexo-theme-3-hexo" target="_blank">3-hexo</a> theme</p>-->

    </div>
    <div class="full-toc">
        <button class="full" data-title="切换全屏 快捷键 s"><span class="min "></span></button>
<button class="post-toc-menu" data-title="打开TOC 快捷键 w"><span class="post-toc-menu-icons"></span></button>
<div class="post-toc"><span class="post-toc-title">目录</span>
    <div class="post-toc-content">

    </div>
</div>
<a class="" id="rocket" ></a>

    </div>
</div>
<div class="acParent"></div>

<div class="hide_box" onclick="dashangToggle()"></div>
<div class="shang_box">
    <a class="shang_close"  onclick="dashangToggle()">×</a>
    <div class="shang_tit">
        <p>喜欢就点赞,疼爱就打赏</p>
    </div>
    <div class="shang_payimg">
        <div class="pay_img">
            <img src="/blog/img/alipay.jpg" class="alipay" title="扫码支持">
            <img src="/blog/img/weixin.jpg" class="weixin" title="扫码支持">
        </div>
    </div>
    <div class="shang_payselect">
        <span><label><input type="radio" name="pay" checked value="alipay">支付宝</label></span><span><label><input type="radio" name="pay" value="weixin">微信</label></span>
    </div>
</div>


</body>
<script src="/blog/js/jquery.pjax.js?v=1.0.1x" ></script>

<script src="/blog/js/script.js?v=1.0.1x" ></script>
<script>
    var img_resize = 'default';
    /*作者、标签的自动补全*/
    $(function () {
        $('.search').AutoComplete({
            'data': ['@pgmanor','#AQS','#attr','#aysnc','#beanmap','#bigdecimal','#blog','#chrome','#dict','#dll','#doc','#docker','#domain','#elementadmin','#es','#excel','#farm','#fastjson','#func','#git','#github','#guide','#hadoop','#hexo','#idea','#initialzr','#jackson','#java','#jboss','#jdni','#jetbrains','#jfinalshell','#joplin','#JPA','#junit','#jupyter','#keepavlie','#kill','#linux','#LocalDate','#lock','#markdown','#maven','#message','#mock','#mq','#mycat','#mysql','#nginx','#notebook','#postman','#powermock','#python','#redis','#rest','#sharding-jdbc','#spark','#springboot','#testng','#tornado','#track','#transactional','#uuid','#vuepress','#web','#windows','#zookeeper','#分库分表','#分页','#加密','#启动','#工具','#并发','#序列化','#微服务','#性能分析','#手册','#有道云','#模板','#百度云盘','#算法','#面试','#项目',],
            'itemHeight': 20,
            'width': 418
        }).AutoComplete('show');
    })
    function initArticle() {
        /*渲染对应的表格样式*/
        
            $(".post .pjax table").addClass("green_title");
        

        /*渲染打赏样式*/
        
        $("input[name=pay]").on("click", function () {
            if($("input[name=pay]:checked").val()=="weixin"){
                $(".shang_box .shang_payimg .pay_img").addClass("weixin_img");
            } else {
                $(".shang_box .shang_payimg .pay_img").removeClass("weixin_img");
            }
        })
        

        /*高亮代码块行号*/
        
        $('pre code').each(function(){
            var lines = $(this).text().trim().split('\n').length, widther='';
            if (lines>99) {
                widther = 'widther'
            }
            var $numbering = $('<ul/>').addClass('pre-numbering ' + widther).attr("unselectable","on");
            $(this).addClass('has-numbering ' + widther)
                    .parent()
                    .append($numbering);
            for(var i=1;i<=lines;i++){
                $numbering.append($('<li/>').text(i));
            }
        });
        

        /*访问数量*/
        
        $.getScript("//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js");
        

        /*代码高亮，行号对齐*/
        $('.pre-numbering').css('line-height',$('.has-numbering').css('line-height'));

        
        
    }

    /*打赏页面隐藏与展示*/
    
    function dashangToggle() {
        $(".shang_box").fadeToggle();
        $(".hide_box").fadeToggle();
    }
    

</script>

<!--加入行号的高亮代码块样式-->

<style>
    pre{
        position: relative;
        margin-bottom: 24px;
        border-radius: 10px;
        border: 1px solid #e2dede;
        background: #FFF;
        overflow: hidden;
    }
    code.has-numbering{
        margin-left: 30px;
    }
    code.has-numbering.widther{
        margin-left: 35px;
    }
    .pre-numbering{
        margin: 0px;
        position: absolute;
        top: 0;
        left: 0;
        width: 20px;
        padding: 0.5em 3px 0.7em 5px;
        border-right: 1px solid #C3CCD0;
        text-align: right;
        color: #AAA;
        background-color: #fafafa;
    }
    .pre-numbering.widther {
        width: 35px;
    }
</style>

<!--自定义样式设置-->
<style>
    
    
    .nav {
        width: 442px;
    }
    .nav.fullscreen {
        margin-left: -442px;
    }
    .nav-left {
        width: 120px;
    }
    
    
    @media screen and (max-width: 1468px) {
        .nav {
            width: 442px;
        }
        .nav.fullscreen {
            margin-left: -442px;
        }
        .nav-left {
            width: 150px;
        }
    }
    
    
    @media screen and (max-width: 1024px) {
        .nav {
            width: 442px;
            margin-left: -442px
        }
        .nav.fullscreen {
            margin-left: 0;
        }
        .nav .hide-list.fullscreen {
            left: 442px
        }
    }
    
    @media screen and (max-width: 426px) {
        .nav {
            width: 100%;
        }
        .nav-left {
            width: 100%;
        }
    }
    
    
    .nav-right .title-list nav a .post-title, .nav-right .title-list #local-search-result a .post-title {
        color: #383636;
    }
    
    
    .nav-right .title-list nav a .post-date, .nav-right .title-list #local-search-result a .post-date {
        color: #5e5e5f;
    }
    
    
    .nav-right nav a.hover, #local-search-result a.hover{
        background-color: #e2e0e0;
    }
    
    

    /*列表样式*/
    
    .post .pjax article .article-entry>ol, .post .pjax article .article-entry>ul, .post .pjax article>ol, .post .pjax article>ul{
        border: #e2dede solid 1px;
        border-radius: 10px;
        padding: 10px 32px 10px 56px;
    }
    .post .pjax article .article-entry li>ol, .post .pjax article .article-entry li>ul,.post .pjax article li>ol, .post .pjax article li>ul{
        padding-top: 5px;
        padding-bottom: 5px;
    }
    .post .pjax article .article-entry>ol>li, .post .pjax article .article-entry>ul>li,.post .pjax article>ol>li, .post .pjax article>ul>li{
        margin-bottom: auto;
        margin-left: auto;
    }
    .post .pjax article .article-entry li>ol>li, .post .pjax article .article-entry li>ul>li,.post .pjax article li>ol>li, .post .pjax article li>ul>li{
        margin-bottom: auto;
        margin-left: auto;
    }
    

    /* 背景图样式 */
    
    


    /*引用块样式*/
    

    /*文章列表背景图*/
    

    
</style>






<div class="mobile-menus-out" >

</div>
<div class="mobile-menus">
    
    
    
    <a class="dynamic-menu " target="_blank"  href="https://www.iworkh.com/">iworkh</a>
    
    
    <a class="dynamic-menu " target="_blank"  href="https://gitee.com/pgmanor">gitee</a>
    
</div>


<div style="position:absolute; bottom: 0; right: 0;">
    <iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=150 height=40 src="//music.163.com/outchain/player?type=2&id=1323150930&auto=0&height=32"></iframe>
</div>

</html>
